package paySetting

import (
	"github.com/gofiber/fiber/v2"
	"sg-backend/global"
	"sg-backend/model/paylog"
)

type _paymentJsonType struct {
	TypeList []string `json:"typeList"`
}

func GetPaymentType(ctx *fiber.Ctx) error {

	// 获取支出类型
	var payTypeList []paylog.PayType
	if err := global.DB.Where("user_id = ?", global.AuthUser.UserId).Find(&payTypeList); err.Error != nil {
		return ctx.JSON(fiber.Map{
			"status":  "error",
			"message": "解构支出类型List失败！！",
		})
	}

	// 返回
	return ctx.JSON(fiber.Map{
		"status":  "done",
		"message": "请求成功！",
		"data":    payTypeList,
	})
}
